package com.kexin.common.utils;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.kexin.common.user.service.IConfigDataService;
import com.kexin.coupon.service.ICouponOrderService;

/**
 * 静态工具类获取bean容器的对象
 * @author ao
 * @since 2021-07-22
 */
@Component
public class ApplicationContextUtil {

	@Autowired
	private IConfigDataService configDataService;

	@Autowired
	private ICouponOrderService couponOrderService;

	private static ApplicationContextUtil applicationContextUtil;

	@PostConstruct
	public void init() {
		applicationContextUtil = this;
		applicationContextUtil.configDataService = configDataService;
		applicationContextUtil.couponOrderService = couponOrderService;
	}

	public static IConfigDataService getConfigDataService() {
		return applicationContextUtil.configDataService;
	}

	public static ICouponOrderService getCouponOrderService() {
		return applicationContextUtil.couponOrderService;
	}
}
